package com.ruoyi.web.controller.ring;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.ring.domain.DailyTagsConf;
import com.ruoyi.ring.service.IDailyTagsConfService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 事件小计内容
 * 
 * @author liuwp
 * @date 2025-08-18
 */
@RestController
@RequestMapping("/ring/daily_tags_conf")
public class DailyTagsConfController extends BaseController
{
    @Resource
    private IDailyTagsConfService dailyTagsConfService;

    /**
     * 查询事件小计内容列表
     */
    @PreAuthorize("@ss.hasPermi('ring:daily_tags_conf:list')")
    @GetMapping("/list")
    public TableDataInfo list(DailyTagsConf dailyTagsConf)
    {
        startPage();
        List<DailyTagsConf> list = dailyTagsConfService.selectDailyTagsConfList(dailyTagsConf);
        return getDataTable(list);
    }

    /**
     * 导出事件小计内容列表
     */
    @PreAuthorize("@ss.hasPermi('ring:daily_tags_conf:export')")
    @Log(title = "事件小计内容", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DailyTagsConf dailyTagsConf)
    {
        List<DailyTagsConf> list = dailyTagsConfService.selectDailyTagsConfList(dailyTagsConf);
        ExcelUtil<DailyTagsConf> util = new ExcelUtil<DailyTagsConf>(DailyTagsConf.class);
        util.exportExcel(response, list, "事件小计内容数据");
    }

    /**
     * 获取事件小计内容详细信息
     */
    @PreAuthorize("@ss.hasPermi('ring:daily_tags_conf:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(dailyTagsConfService.selectDailyTagsConfById(id));
    }

    /**
     * 新增事件小计内容
     */
    @PreAuthorize("@ss.hasPermi('ring:daily_tags_conf:add')")
    @Log(title = "事件小计内容", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DailyTagsConf dailyTagsConf)
    {
        return toAjax(dailyTagsConfService.insertDailyTagsConf(dailyTagsConf));
    }

    /**
     * 修改事件小计内容
     */
    @PreAuthorize("@ss.hasPermi('ring:daily_tags_conf:edit')")
    @Log(title = "事件小计内容", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DailyTagsConf dailyTagsConf)
    {
        return toAjax(dailyTagsConfService.updateDailyTagsConf(dailyTagsConf));
    }

    /**
     * 删除事件小计内容
     */
    @PreAuthorize("@ss.hasPermi('ring:daily_tags_conf:remove')")
    @Log(title = "事件小计内容", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(dailyTagsConfService.deleteDailyTagsConfByIds(ids));
    }
}
